package org.oaix;

/**
 * Hello world!
 *
 */
public class App {

    public static void main( String[] args ) {
        Eat.A.eating();
    }


    static class Animal implements AutoCloseable{

        public Animal(){
            System.out.println("Animal...init");
        }

        public Animal(String name){
            System.out.println("My name is "+name+".");
        }

        @Override
        public void close() throws Exception {
            System.out.println("close");
        }
    }

    static class Dog extends Animal{

        public Dog(){
            System.out.println("Dog...init");
        }
        {
            System.out.println("Dog...Base...init");
        }

        public Dog(String name){
            System.out.println("My name is "+name+".");
        }
    }

     enum Eat{

        A(1){
            @Override
            protected void eating() {
                System.out.println(A.time+":"+this.getClass());
            }
        },;
        private Integer time;

        Eat(Integer time) {
            this.time = time;
        }

        protected abstract void eating();
    }
}
